import requests
from config import headers_web, url_cloud


class EntranceGuardAuthorization:
    def __init__(self):
        self.url = url_cloud
        self.headers = headers_web

    @classmethod
    def get_issues_tatuss(cls, url_cloud: str, headers=headers_web, params=None):
        """
        summary:接口-获取门禁下发状态
        description:云课堂管理端门禁临时授权使用
        :param url_cloud:
        :param headers:
        :param params:
        :return:
        """
        url = url_cloud + "/teachinglaboratoryapi/v1/entranceguardauthorization/issuestatuss"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def get_sources(cls, url_cloud: str, headers=headers_web, params=None):
        """
        summary:接口-获取所有的授权来源
        description:云课堂管理端门禁临时授权使用
        :param url_cloud:
        :param headers:
        :param params:
        :return:
        """
        url = url_cloud + "/teachinglaboratoryapi/v1/entranceguardauthorization/sources"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def post_entrance_pagelist(cls, url_cloud: str, headers=headers_web, params=None,json=None):
        """
        summary:获取门禁记录接口
        description:Web端管理端使用
        :param url_cloud:
        :param headers:
        :param params:
        :return:
        """
        url = url_cloud + "/teachinglaboratoryapi/v1/entranceguardauthorizationpagelist"
        r = requests.post(url=url, headers=headers, params=params,json=json)
        return r